// pages/team/index.js
import {
  request
} from "../../request/request.js";

Page({

  /**
   * 页面的初始数据
   */
  data: {
    admin:[],
    member:[]
  },
  onLoad: function (options) {
    var that = this;
        let baseUrl = 'http://172.17.60.141:80/';
        let userId = wx.getStorageSync("userId");
        request({
                url: baseUrl + 'getGroupServlet',
                data: {
                    user: userId,
                },
                method: 'GET',
            })
            .then(result => {
              console.log(result.data);
              //我管理的模块
                for(let i=0;i<result.data.group_manage.length;i++){
                  var newArray = result.data.group_manage[i]
                  that.data.admin = that.data.admin.concat(newArray);
                  that.setData({
                    admin: that.data.admin,
                  })
                }
              //我加入的模块
              for(let i=0;i<result.data.group_join.length;i++){
                var newArray = result.data.group_join[i]
                that.data.member = that.data.member.concat(newArray);
                // console.log(that.data.member);
                that.setData({
                  member: that.data.member,
                })
              }
            })
},
  toAddteam:function(e){
    wx.navigateTo({
      url: '/pages/addteam/index',
    })
  },
  toJointeam:function(e){
    wx.navigateTo({
      url: '/pages/JoinTeam/index',
    })
  },
  //获取点击信息
  // getInfo:function (e) {
  //     console.log(e.target.dataset)
  // }

})
